-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lease collector #1038
Add lease collector #1038
Conversation
How to fix the problem correctly https://travis-ci.org/kubernetes/kube-state-metrics/jobs/642760515?utm_medium=notification&utm_source=github_status ? |
You need jsonnet and jb installed and then run “make validate-manifests”. |
Looks like there is a CI failure regarding linting. You can run |
Fixed in this commit: b82adc4 |
Could you squash your changes? Otherwise this lgtm |
internal/store/lease.go
Outdated
@@ -0,0 +1,113 @@ | |||
/* | |||
Copyright 2016 The Kubernetes Authors All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tests/manifests/lease.yaml
Outdated
spec: | ||
holderIdentity: kube-master | ||
leaseDurationSeconds: 40 | ||
renewTime: "2020-01-26T09:52:23.548762Z" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need EOL here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
internal/store/builder.go
Outdated
@@ -187,6 +188,7 @@ var availableStores = map[string]func(f *Builder) cache.Store{ | |||
"validatingwebhookconfigurations": func(b *Builder) cache.Store { return b.buildValidatingWebhookConfigurationStore() }, | |||
"volumeattachments": func(b *Builder) cache.Store { return b.buildVolumeAttachmentStore() }, | |||
"verticalpodautoscalers": func(b *Builder) cache.Store { return b.buildVPAStore() }, | |||
"leases": func(b *Builder) cache.Store { return b.buildLeases() }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lexical order please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
docs/README.md
Outdated
@@ -73,6 +73,7 @@ Per group of metrics there is one file for each metrics. See each file for speci | |||
- [ValidatingWebhookConfiguration Metrics](validatingwebhookconfiguration.md) | |||
- [VerticalPodAutoscaler Metrics](verticalpodautoscaler-metrics.md) | |||
- [VolumeAttachment Metrics](volumeattachment-metrics.md) | |||
- [Lease Metrics](lease-metrics.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lexical order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
b82adc4
to
70de36e
Compare
done |
lgtm but giving @tariq1890 another chance to review |
internal/store/lease_test.go
Outdated
c.Func = generator.ComposeMetricGenFuncs(leaseMetricFamilies) | ||
c.Headers = generator.ExtractMetricFamilyHeaders(leaseMetricFamilies) | ||
if err := c.run(); err != nil { | ||
t.Errorf("unexpected collecting result in %vth run:\n%s", i, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Errorf("unexpected collecting result in %vth run:\n%s", i, err) | |
t.Errorf("unexpected collecting result in %dth run:\n%v", i, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pkg/options/collector.go
Outdated
@@ -53,5 +53,6 @@ var ( | |||
"storageclasses": struct{}{}, | |||
"validatingwebhookconfigurations": struct{}{}, | |||
"volumeattachments": struct{}{}, | |||
"leases": struct{}{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be in lexical order too please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
docs/lease-metrics.md
Outdated
@@ -0,0 +1,6 @@ | |||
# Leases Metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Leases Metrics | |
# Lease Metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| Metric name| Metric type | Labels/tags | Status | | ||
| ---------- | ----------- | ----------- | ----------- | | ||
| kube_lease_renew_time | Gauge | `lease`=<lease-name> | EXPERIMENTAL | | ||
| kube_lease_owner | Gauge | `lease`=<lease-name> <br> `owner_kind`=<onwer kind> <br> `owner_name`=<owner name> | EXPERIMENTAL | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be in lexical order too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Sorry, the PR approve was by mistake. Almost there :). Thanks for your hard work! |
70de36e
to
f5729a5
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brancz, qw1mb0 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Does kubelet have 2 mechanisms for confirming that node is available: https://kubernetes.io/docs/concepts/architecture/nodes/#heartbeats
Unfortunately, nodeStatus is updated every 5 minutes, which is too much, but in Lease object this information is updated every 10 seconds. Having information about the updateTime kubelet in the metrics, we will be able to determine much faster that something has happened to the node.
This collector adds a few new metrics for each Lease object.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):No issue about lease objects.